import { type BaseListReq, type BaseListResp } from '#/api/model/baseModel';
import { requestClient } from '#/api/request';

import { type AgentListResp, type AgentReq } from './model/listModel';

enum Agentlist {
  Create = '/cs-api/agent',
  Delete = '/cs-api/agent/delete',
  GetAgentList = '/cs-api/agent/list',
  UpdateAgent = '/cs-api/agent/update',
}

/**
 * @description: Get customer list
 */

export const getAgentList = (params: BaseListReq) => {
  return requestClient.get<BaseListResp<AgentListResp>>(
    Agentlist.GetAgentList,
    {
      params,
    },
  );
};

/**
 *  @description: Create a new customer
 */
export const createagent = (data: AgentReq) => {
  return requestClient.post('/cs-api/agent', data);
};

/**
 *  @description: Update the customer
 */
export const updateagent = (data: AgentReq) => {
  return requestClient.put('/cs-api/agent', data);
};

/**
 *  @description: Delete customer
 */
export const deleteAgent = (id: number) => {
  return requestClient.delete(`/cs-api/agent/${id}`);
};

/**
 *  @description: Get customer By ID
 */
export const getAgentlistById = (id: number) => {
  return requestClient.get<AgentListResp>(`/cs-api/agent/${id}`);
};
